<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" >
<head>
    <title th:text="文件上传">index</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script type="text/javascript" th:src="@{/static/js/jquery-1.12.3.min.js}"></script>
     <link th:href="@{/static/css/model.css}" rel="stylesheet"/> 
</head>
<style type="text/css">

</style>
<body>
	<div class="div_header">
		<div class="div_mav">
			<div class="div_logo"><a th:href="@{/index}">hdlend | 个人博客</a></div>
			<div class="div_menu">
				<ul>
					<li><a th:href="@{/index}">首页</a></li>
					<li>关于我</li>
					<li>留言</li>
				</ul>
			</div>
		</div>
	</div>
	<div class="blank"></div>
	<div class="div_main">
		<div class="div_info">
			<div class="div_serach">
			</div>
			<div class="article">
				<div id="uploadForm">
				    <input id="file" type="file" name="file"/>
				    <button id="upload" type="button" onclick="fileUpload()">upload</button>
				</div>
			</div>
		</div>
	
	</div>
	<script type="text/javascript">
 
	function fileUpload(){
		
		var formData = new FormData();
		formData.append('file', $('#file')[0].files[0]);
		$.ajax({
		    url: '/fileUpload',
		    type: 'POST',
		    cache: false,
		    data: formData,
		    processData: false,
		    contentType: false
		}).done(function(res) {
			console.info(res);
			if(res.status=='success')
				alert("success");
			else
				alert("false");
		}).fail(function(res) {
			alert("faile");
		});
	}
 
</script>


</body>
</html>